<?php
include_once("model/Model.php");

class Controller {
	public $model;
	
	public function __construct()  
    {  
        $this->model = new Model();

    } 
	
	public function invoke()
	{
		if (!isset($_GET['route']) && !isset($_GET['book']))
		{
			// no special book is requested, we'll show a list of all available books
			$books = $this->model->getBookList();
			include 'view/booklist.php';
		}
		else if (isset($_GET['book']))
		{
			// show the requested book
			$book = $this->model->getBook($_GET['book']);
			include 'view/viewbook.php';
		}
		else if(isset($_GET['route']))
		{
			$page = 'view/' .$_GET['route'] .'.php';
			echo $page;
			include $page;
			
			//include 'view/login.php';
		}
	}
}

?>